from flask_restful import Resource

from restful.api__.session import  login_required_current_user_generate, \
    uid_required_target_user_generate
from restful.model.query import QueryMultipleInstances
from restful.model.tables import Blog, Check
from restful.response import ResponseSuccess


class UserAllPostsPublished(Resource):
    @login_required_current_user_generate
    @uid_required_target_user_generate
    def get(self,target_user,current_user):
        checks=QueryMultipleInstances(Check,{'uid':target_user.id,'checked':True,'passed':True})

        return ResponseSuccess(data=[{
            'pid':i.pid,
        }for i in checks])